<!DOCTYPE html>
<html>  
<head>
<title>Login</title>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
</head>
<body>
    <input type="button" value="Get" onclick="get()">
    <input type="button" value="logout" onclick="logout()">
</body>
<script type="text/javascript">

function get(){
    $.ajax({
        url: "/tokenAuth/user/fx",
        dataType: "json",   
        type:"GET",
        beforeSend: function(request) {
            //将cookie中的token信息放于请求头中
            request.setRequestHeader("authStr", $.cookie('authStr'));
        },
        success:function(res){
            console.log(res);
        }
    });
}

function logout(){
    $.ajax({
        url: "/tokenAuth/token",
        dataType: "json",   
        type:"DELETE",
        beforeSend: function(request) {
            //将cookie中的token信息放于请求头中
            request.setRequestHeader("authStr", $.cookie('authStr'));
        },
        success:function(res){
            console.log(res);
        }
    });
}
</script>
</html>